# Base64编码是一种将二进制数据转换为文本格式的编码方式
# import base64,json,time,hashlib
# # 头部信息
# heard_data = {"typ": "jwt","alg": "Hs256"}
# # json.dumps(heard_data)将字典格式转成字符串
# # .encode()将字符串转成字节对象
# # .decode()用于将编码后的数据转换回原始数据
# # base64.b64encode函数用于将二进制数据编码为Base64格式的字符串
# head = base64.b64encode(json.dumps(heard_data).encode()).decode()
# print("-----头部信息-----")
# print(head)
#
# # 载荷信息 : playload
# iat = int(time.time())
#
# payload_data = {
#     "sub": "admin",
#     "exp": iat+60*60,
#     "iat": iat,
#     "name": "kk",
#     "user_id": 1,
#     "admin": True,
#     "acc_password": "asjdfalkfdjviaupwuradjPAHAFJSDF"
# }
#
# payload = base64.b64encode(json.dumps(payload_data).encode()).decode()
# print("-----payload载荷部分Base64信息-----")
# print(payload)
#
# # 签证
# secret = "django-insecure-mwap67jc^4l5db+xw55=8ou2*b)&nlo%x76i2x0w-(k+#9kevn"
# data = head + payload + secret
# # hashlib.sha256()函数用于计算SHA-256哈希值
# hs256 = hashlib.sha256()
# # update()方法用于更新哈希对象的状态，接受一个字节对象作为参数
# hs256.update(data.encode("utf-8"))
# # hexdigest()方法用于获取哈希值的十六进制表示形式
# signtrue = hs256.hexdigest()
# print("-----签证信息-----")
# print(signtrue)
#
# token = f"{head}.{payload}.{signtrue}"
#
# print("-----最终jwt数据格式-----")
# print(token)

# from ronglian_sms_sdk import SmsSDK
# accId = "2c94811c9035ff9f01923173f41d6611"
# accToken = "28e1f9c9b6a940d79e02b2c34b35810b"
# appId = "2c94811c9035ff9f019232186d1566a4"

# def send_message():
#     sdk = SmsSDK(accId, accToken, appId)
#     # tid = '容联云通讯创建的模板ID'
#     # mobile = '手机号1,手机号2'
#     # datas = ('变量1', '变量2')
#     tid = "1"
#     mobile = "18307289925"
#     datas = ("9925","2")
#     resp = sdk.sendMessage(tid, mobile, datas)
#     print(resp)
# send_message()

# import oss2,uuid
# OSS_AccessKey_ID = 'LTAI5t86iwHqyPpsuq7BMVbg'
# OSS_AccessKey_Secret = 'jA5lDoc3OBeuaXPXSMmVWjzV5KHwzQ'
# OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com"   #访问域名
# OSS_BUCKET_NAME = "fuguangkk" #存储空间名称

# 创建存储空间的操作实例对象
# 认证
# auth = oss2.Auth(OSS_AccessKey_ID,OSS_AccessKey_Secret)
#
# bucket = oss2.Bucket(auth,OSS_ENDPOINT,OSS_BUCKET_NAME)
# # http://128.0.0.1:9000/uploads/2024/2/s238dflansdf.png
# image_name = f'test/{str(uuid.uuid4())}.jpg'
#
# # 查找一个文件（图片）
# with open('C:\\Users\\zhang87k75\\Pictures\\1.jpg','rb') as f:
#     # 上传文件对象  --- 阿里云oss上传
#     # 文件名，文件对象：流
#     result = bucket.put_object(image_name,f.read())
#     print('----------上传结果------------')
#     print(result)
